import Dialog from "../../Game/dialog/Dialog";
import Scene from "../../Scene";
import { TButton, TLayout } from "../../SceneControl";

const { ccclass, property } = cc._decorator;

@ccclass
export default class PauseDialogScene extends Scene {

    protected onEnable(): void {
        super.onEnable();
        this.initScene();
    }

    public initScene() {
        let layout = new TLayout();
        let btnComps = this.node.getComponentsInChildren(cc.Button);
        let btns = [[]];
        btnComps.forEach(item => btns[0].push(new TButton(item.node)));
        btns.forEach(a => a.forEach(b => b.offset = cc.v3(60, -30)));
        layout.buttonList = btns;
        this.tscene.addLayout(layout);
        this.tscene.onBack = () => {
            this.getComponent(Dialog).closeDialog();
        }
        this.tscene.joinController();
    }

}
